<me:UIAB50 x:Class="WPFExcelReport.TAB50COMBINE"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"     
                    xmlns:me="clr-namespace:WPFExcelReport"  
                    xmlns:Localization="clr-namespace:Localization;assembly=Localization" 
                     xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls" 
                    xmlns:PR="clr-namespace:WPFExcelReport;assembly=TICC_PRULES"   
                    x:Name="TV"
                    Loaded="Window_Loaded"
     >
    <me:UIAB50.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>   
        <CollectionViewSource  x:Key="vwDetail"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:Divideby100  x:Key="d100"/>
        <ucd:Divideby1000  x:Key="d1000"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
        <ucd:NOTBoolToVisibilityConverter x:Key="nbv"/>
    </me:UIAB50.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition   Height="Auto" />
            <RowDefinition   Height="1*" /> 
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition  Width="1*" />
            <ColumnDefinition  Width="1*" />
        </Grid.ColumnDefinitions>
        <TabControl Grid.Row="1" Grid.Column="0">
            <TabItem Header="{Binding Source={Localization:Translate Word=销售单}}">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition   Height="Auto" />
                        <RowDefinition   Height="1*" />
                    </Grid.RowDefinitions>
                    <StackPanel>
                        <WrapPanel>
                            <Grid Margin="10,0,0,0"  >
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                                </Grid.ColumnDefinitions>
                                <ex:TXT72  Grid.Column="1" MaxLength="2" PRE="  " Text="{Binding KRS,ElementName=TV}" Width="40" FontSize="18"/>
                                <ex:TXT72  Grid.Column="2" MaxLength="6" PRE="000000" IsAutoClear="True"  Text="{Binding LFD,ElementName=TV}" Width="120" FontSize="18"/>
                                <ex:TXT72  Grid.Column="3" MaxLength="3" PRE="000" Text="{Binding POS,ElementName=TV}" Width="40" FontSize="18"/>
                            </Grid>
                            <Button Grid.Column="1" Height="20"  Width="Auto" Margin="0,0,0,0" Content="{Binding Source={Localization:Translate Word=查询}}"  Click="QueryVKPCommand"/>
                        </WrapPanel>
                       
                    </StackPanel> 
                    <DataGrid  Grid.Row="1"  
                         AutoGenerateColumns="False" 
                        EnableRowVirtualization="True" 
                        ItemsSource="{Binding Source={StaticResource ResourceKey=vwMaster}}" 
                        HeadersVisibility="Column"  CanUserReorderColumns="True" CanUserResizeRows="True" CanUserSortColumns="True" 
                       RowDetailsVisibilityMode="VisibleWhenSelected" Width="Auto"  EnableColumnVirtualization="True" 
                        HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
                        <DataGrid.Columns>
                            <DataGridTextColumn Binding="{Binding Path=VKPEXART, Converter={StaticResource ResourceKey=gb2312}}" Header="{Binding Source={Localization:TranslateExtension Word=状态}}"  Width="60" />
                            <DataGridTextColumn Binding="{Binding Path=ABKARTSB,Converter={StaticResource ResourceKey=gb2312}}" 
                                        Header="{Binding Source={Localization:Translate Word=合投}}" Width="Auto" MinWidth="30" />
                            <DataGridTextColumn Binding="{Binding Path=ABPAUFKRS}"    Width="30" />
                            <DataGridTextColumn Binding="{Binding Path=ABPAUFLFD}" Header="{Binding Source={Localization:TranslateExtension Word=复板单}}"  Width="60" />
                            <DataGridTextColumn Binding="{Binding Path=ABPAUFPOS}"   Width="40" />
                            <DataGridTextColumn Binding="{Binding Path=ABPSOLLMENGE5, Converter={StaticResource ResourceKey=d100}}" Header="{Binding Source={Localization:TranslateExtension Word=KG}}"  Width="60" />
                            <DataGridTextColumn Binding="{Binding Path=ABPART}" Header="{Binding Source={Localization:TranslateExtension Word=品种}}"  Width="120" />
                            <DataGridTextColumn Binding="{Binding Path=ABPFARBE}" Header="{Binding Source={Localization:TranslateExtension Word=色号}}"  Width="90"></DataGridTextColumn>
                            <DataGridTextColumn Binding="{Binding Path=VKPAUFKRS}"    Width="30" />
                            <DataGridTextColumn Binding="{Binding Path=VKPAUFLFD}" Header="{Binding Source={Localization:TranslateExtension Word=销售单}}"  Width="60" />
                            <DataGridTextColumn Binding="{Binding Path=VKPAUFPOS}"   Width="40" />
                        </DataGrid.Columns>
                    </DataGrid>
                </Grid>

            </TabItem>
            <TabItem Header="{Binding Source={Localization:Translate Word=生产单}}">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition   Height="Auto" />
                        <RowDefinition   Height="1*" /> 
                    </Grid.RowDefinitions>
                    <StackPanel Grid.Row="0">
                        <WrapPanel>
                            <Grid Margin="10,0,0,0"  >
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                                </Grid.ColumnDefinitions>
                                <TextBlock Grid.Column="0" Text="{Binding Source={Localization:Translate Word=基础生产单:}}" ></TextBlock>
                                <ex:TXT72  Grid.Column="1" MaxLength="2" PRE="  " Text="{Binding KRS,ElementName=TV}" Width="40" FontSize="18"/>
                                <ex:TXT72  Grid.Column="2" MaxLength="6" PRE="000000" IsAutoClear="True" Text="{Binding LFD,ElementName=TV}" Width="120" FontSize="18"/>
                                <ex:TXT72  Grid.Column="3" MaxLength="3" PRE="000" IsAutoClear="True" Text="{Binding POS,ElementName=TV}" Width="40" FontSize="18"/>
                            </Grid>
                            <Button Grid.Column="1" Height="20"  Width="Auto" Margin="0,0,0,0" Content="{Binding Source={Localization:Translate Word=查询}}"  Click="QueryCommand"/>
                            <PR:TRVRULES Grid.Row="1" Grid.Column="1" 
                                  Visibility="Collapsed" 
                                 Name="cRule"  ARTSTAGE="R"    
                                 dwRule="{Binding dwRule,ElementName=TV}"
                                 WH="{Binding WH,ElementName=TV}"
                                ORDERNUM="{Binding KEY,ElementName=TV}"/>
                        </WrapPanel> 
                    </StackPanel> 
                   <DataGrid  Grid.Row="1"  
                         AutoGenerateColumns="False" 
                        EnableRowVirtualization="True" 
                        ItemsSource="{Binding Source={StaticResource ResourceKey=vwMaster}}" 
                        HeadersVisibility="Column"  CanUserReorderColumns="True" CanUserResizeRows="True" CanUserSortColumns="True" 
                       RowDetailsVisibilityMode="VisibleWhenSelected" Width="Auto"  EnableColumnVirtualization="True" 
                        HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
                    <DataGrid.Columns>
                        <DataGridTextColumn Binding="{Binding Path=ABPAUFKRS}"    Width="30" />
                        <DataGridTextColumn Binding="{Binding Path=ABPAUFLFD}" Header="{Binding Source={Localization:TranslateExtension Word=生产单}}"  Width="60" />
                        <DataGridTextColumn Binding="{Binding Path=ABPAUFPOS}"   Width="40" />
                        <DataGridTextColumn Binding="{Binding Path=ABPSOLLMENGE5, Converter={StaticResource ResourceKey=d100}}" Header="{Binding Source={Localization:TranslateExtension Word=KG}}"  Width="60" />
                        <DataGridTextColumn Binding="{Binding Path=ABPART}" Header="{Binding Source={Localization:TranslateExtension Word=品种}}"  Width="120" />
                        <DataGridTextColumn Binding="{Binding Path=ABPFARBE}" Header="{Binding Source={Localization:TranslateExtension Word=色号}}"  Width="90"></DataGridTextColumn>
                    </DataGrid.Columns>
                </DataGrid>
                </Grid>
            </TabItem>
        </TabControl> 
        <Grid Grid.Row="1"  Grid.Column="1">            
                <Grid.RowDefinitions>
                    <RowDefinition   Height="Auto" />
                    <RowDefinition   Height="1*" />
                </Grid.RowDefinitions>
            <WrapPanel Grid.Row="0">
                <Button  Height="30"  Width="30" Margin="10,0,0,0"   Click="btnCombine_Click" KeyboardNavigation.TabIndex="3" IsDefault="True">
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Add.png" />
                    </Button.Background>
                </Button>
                <TextBlock  Text="{Binding Source={Localization:Translate Word=加入}}" ></TextBlock>
                <Button  Height="30"  Width="30" Margin="10,0,0,0"   Click="btnCombineConvert_Click" KeyboardNavigation.TabIndex="3" IsDefault="True">
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Convert.png" />
                    </Button.Background>
                </Button>
                <TextBlock  Text="{Binding Source={Localization:Translate Word=合投}}" ></TextBlock>
                <Grid Margin="20,0,0,0" Visibility="Collapsed">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="80"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock Grid.Column="0" Text="{Binding Source={Localization:Translate Word=数量}}" ></TextBlock>
                    <TextBox  Grid.Column="1" Name="txtTQty" Text="0" ></TextBox>
                </Grid>
                <Grid Visibility="Collapsed">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="80"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock Grid.Column="0" Text="{Binding Source={Localization:Translate Word=交期}}" ></TextBlock>
                    <TextBox  Grid.Column="1" Name="txtDD" Text="0" ></TextBox>
                </Grid>
                <Button  Height="30"  Width="30" Margin="10,0,0,0"   Click="btnRemoveFromCombine_Click" KeyboardNavigation.TabIndex="3" IsDefault="True">
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Remove.png" />
                    </Button.Background>
                </Button>
                <TextBlock  Text="{Binding Source={Localization:Translate Word=移除}}" ></TextBlock>
            </WrapPanel>
            <DataGrid  Grid.Row="1"
                         AutoGenerateColumns="False" 
                        EnableRowVirtualization="True" 
                        ItemsSource="{Binding Source={StaticResource ResourceKey=vwDetail}}" 
                        HeadersVisibility="Column"  CanUserReorderColumns="True" CanUserResizeRows="True" CanUserSortColumns="True" 
                       RowDetailsVisibilityMode="VisibleWhenSelected" Width="Auto"   EnableColumnVirtualization="True" 
                        HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
                <DataGrid.Columns>
                    <DataGridTextColumn Binding="{Binding Path=ABPAUFKRS}"    Width="30" />
                    <DataGridTextColumn Binding="{Binding Path=ABPAUFLFD}" Header="{Binding Source={Localization:TranslateExtension Word=生产单}}"  Width="60" />
                    <DataGridTextColumn Binding="{Binding Path=ABPAUFPOS}"   Width="40" />
                    <DataGridTextColumn Binding="{Binding Path=ABPSOLLMENGE5, Converter={StaticResource ResourceKey=d100}}" Header="{Binding Source={Localization:TranslateExtension Word=KG}}"  Width="60" />
                    <DataGridTextColumn Binding="{Binding Path=ABPART}" Header="{Binding Source={Localization:TranslateExtension Word=品种}}"  Width="120" />
                    <DataGridTextColumn Binding="{Binding Path=ABPFARBE}" Header="{Binding Source={Localization:TranslateExtension Word=色号}}"  Width="90"></DataGridTextColumn>
                </DataGrid.Columns>
            </DataGrid>
        </Grid>
      
    </Grid>
</me:UIAB50>
